﻿

<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>代理商校园管理</title>
	<link rel="stylesheet" href="/css/common2.css">
	<link rel="stylesheet" href="/css/urlty.css">

	<style>
		.two {
			width: 7%;
		}

		.four {
			width: 17%;
			max-width: 10em;
			text-overflow: ellipsis;
			overflow: hidden;
			white-space: nowrap;
		}

		.school-name {
			max-width: 6em;
			text-overflow: ellipsis;
			overflow: hidden;
			white-space: nowrap;
		}

		.search_img {
			position: absolute;
			right: 3%;
		}
	</style>
</head>

<body>
	<div id="vue-root" style="margin-top: 50px;">
		<div class="add action-buttons" v-if="able.add">
			<a href="agent_school_item.html" style="color: white">添加学校</a>
		</div>
		<div class="refresh action-buttons" onclick="location.reload()">刷新</div>
		<input class="search" placeholder="请输入学校名称" style="right: 80px; height: 33px; max-width: 118px;"
			v-model="search.name">
		<img src="../image/search.png" height="35" width="35" class="search_img" @click="getData0">
		<div class="table ">
			<table class="table_top">
				<thead>
					<tr>
						<th class="one">
							<input type="checkbox" class="check-box" v-model="all">
						</th>
						<th>序号</th>
						<th class="school-name">学校名称</th>
						<th>id</th>

						<th>账号</th>
						<th>联系人</th>

						<th>学校入口</th>
						<th>权限设置</th>
						<th>卡数量</th>
						<th class="one">编辑/删除</th>
					</tr>
				</thead>
				<tbody id="list">
					<tr v-for="(school,index) in list" :key="school.id">
						<td class="one">
							<input type="checkbox" class="check-box" v-model="school.checked">
						</td>
						<td> <span v-text="index+1"></span></td>
						<td class="two school-name" v-text="school.name"></td>
						<td v-text="school.id"></td>

						<td v-text="school.username"></td>
						<td v-text="school.linkman"></td>

						<td>
							<a v-if="able.enter" :href="'/school/school_menu.html?id='+school.id" target="_blank">
								<button class="hut_but_tz">进入学校</button>
							</a>
						</td>
						<td>
							<a :href="'../authority_item.html?id='+school.id">
								<button class="hut_but_tz">校园权限</button>
							</a>
						</td>
						<td v-text="school.cardCount"></td>
						<td class="one">
							<div class="option">
								<div v-if="able.edit" class="edit-icon option-icon" @click="edit(school.id)"
									style="position: absolute; left: 20%; top: 30%;">
									<img class="img" src="../image/edit.png" height="20" width="20"
										onmouseover="this.src='../image/edit_light.png'"
										onmouseout="this.src='../image/edit.png'" />
								</div>

								<div v-if="able.del" class="delete-icon option-icon" style="right: 20%; top:30%;position: absolute;">
									<img class="img" src="../image/delete.png" height="20" width="20"
										onmouseover="this.src='../image/delete_light.png'"
										onmouseout="this.src='../image/delete.png'" />
								</div>

							</div>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
		<ul class="pagination" v-if="pages>1">
			<li>
				<a v-if="pageNum!=1" @click="pageNum=1">«</a>
				<a class="pages-jump" v-if="pageNum!=1" @click="pageNum--">‹</a>
				<a v-text="pageNum"></a>
				<a class="pages-jump" v-if="pageNum!=pages" @click="pageNum++">›</a>
				<a v-if="pageNum!=pages" @click="pageNum=pages">»</a>
			</li>
			<li>
				<a v-text="pages"></a>
				<!--页面总数-->
			</li>
		</ul>

	</div>
	<script src="/scriptZIP/qs.min.js"></script>
	<script src="/scriptZIP/vue.min.js"></script>
	<script src="/scriptZIP/axios.min.js"></script>
	<script src="/scriptZIP/dayjs.min.js"></script>
	<script src="/js/common.js"></script>
	<script src="/js/list.js"></script>
	<script src="/js/auth_util.js"></script>
	<script>
		var app = new Vue(merge({
			data: {
				searchs: {
					t1: null,
					t2: null,
				},
				urls: {
					del: '/pc/school/del',
					
				},
				search: {
					schoolGroupId:null
				}
			},
			created: function () {
				var id = top_params().id;
				if (!id) return;
				this.search.agentId = id;
				var schoolGroupId = localStorage.getItem('schoolGroupId');
				if (schoolGroupId && schoolGroupId.trim() !== '' && schoolGroupId !== 'null' && schoolGroupId !== 'undefined') {
					this.search.schoolGroupId=schoolGroupId;
					this.urls.list= '/pc/school/list'
				}else{
					this.urls.list= '/pc/school/list'
				}
				this.getData();
				abled('account', this);
			},
			methods: {
				edit: function (id) {
					location.href = "agent_school_item.html?id=" + id;
				},
				createTime: function (school) {
					return dayjs(school.id / 4096 + 1.56E12).format('YYYY-MM-DD HH:mm:ss');
				},

			}
		}));
	</script>
</body>

</html>